#ifndef INPUT_H
#define INPUT_H

//Ouden headers
#include <core/IInput.h>
#include <utils/Pluginterface.h>
#include <utils/Maths.h>

// Purpose: An basic Windows implementation of the IInput interface.
// Status:  Still in design-stage.
// TODO:    If plan to keep it around for a while, it needs to be brought up to
//          a more modern coding standard.

class WindowsAPIInput : public IInput
{
	
public:
	
	//Constructor and destructor
	WindowsAPIInput();
	~WindowsAPIInput()		{}
	
	//Gather the input
	virtual        void   update();
	
	//Mouse movement
	virtual inline Vector getMousePos()          { return mousepos; }
	virtual inline Vector getMouseMoveVector()   { return mousevector; }
	virtual inline Scalar getMouseMoveAngle()    { return mouseangle; }
	virtual inline Scalar getMouseMoveDistance() { return mousedistance; }
	virtual inline bool   isMouseMoved()         { return mousedistance; }
	
	//Key presses (includes mouse clicks)
	virtual inline bool   getKeyState(Key k)     { return keys[k]; }
	virtual inline bool   getKeyDown(Key k)      { return (!oldkeys[k] && keys[k]); }
	virtual inline bool   getKeyUp(Key k)        { return (oldkeys[k] && !keys[k]); }
	
private:
	
	bool   oldkeys[IInput::MAX_KEYS];   //Old state of all the keys
	bool   keys[IInput::MAX_KEYS];      //State of all the keys
	Vector mousepos;       //Position of the mouse
	Vector mouseoldpos;	   //Old position of the mouse
	Vector mousevector;	   //Vector of last mouse movement
	Scalar mousedistance;  //Distance the mouse moved
	Scalar mouseangle;     //Direction the mouse moved in
	
};

DEFINE_PLUGIN( WindowsAPIInput, IInput )

#endif //INPUT_H 
